package com.hobart.learning.lagou.edu.blogSystem.dao.impl;

import com.hobart.learning.lagou.edu.blogSystem.dao.ArticleDao;
import com.hobart.learning.lagou.edu.blogSystem.mapper.ArticleMapper;
import com.hobart.learning.lagou.edu.blogSystem.pojo.Article;
import com.hobart.learning.lagou.edu.blogSystem.repository.ArticleRepository;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.data.domain.Page;
import org.springframework.data.domain.Pageable;
import org.springframework.stereotype.Repository;

/**
 * @author: Hobart Mr.Bai
 * @create: 2021-05-13 11:11
 * @description:
 * @Version 1.0
 **/
@Repository
public class ArticleDaoImpl implements ArticleDao {

    @Autowired
    private ArticleMapper articleMapper;

    @Autowired
    private ArticleRepository articleRepository;

    @Override
    public Page<Article> getArticleForPage(Pageable paging, Article article) {
        return articleMapper.getArticleForPage(paging, article);
    }

    @Override
    public Page<Article> getArticleAllForPage(Pageable paging, Article article) {
        return articleRepository.findAll(paging);
    }
}
